<?php
/**
 * Copyright 2011  SURFfoundation
 * 
 * This file is part of ESCAPE.
 * 
 * ESCAPE is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * ESCAPE is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with ESCAPE.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * For more information:
 * http://escapesurf.wordpress.com/
 * http://www.surffoundation.nl/
 * 
 * Contact: d.vierkant@utwente.nl
 * 
 * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3
 */
?>
<?php
	/* @var $repositoryUi escape_repositoryui_RepositoryUi */
	$repositoryUi =& $this->requestAttributes['repositoryUi'];
	/* @var $oreObject escape_repository_OreObject */
	$oreObject =& $this->requestAttributes['oreObject'];
	/* @var $aggregation escape_repository_OreAggregation */
	$aggregation =& $this->requestAttributes['aggregation'];
	
	$user =& $repositoryUi->getUser();
	
	$repositoryUi->setTemplateFromAggregation($aggregation);
	
	$templateVariables = array();
	$templateVariables['title'] = 'Edit object';
	$this->requestAttributes['templateVariables'] =& $templateVariables;
?>
<?php $this->displayHeader(); ?>

<div id="escape_notLoggedInWarning" style="display: none">
<p>
<b>WARNING</b>
</p>
<p>
You are not logged in at this moment.
This might be due to a session timeout, network connectivity loss or clicking the log out link in another browser window.
</p>
<p>
If you still have unsaved changes, <strong>do not click the save button now</strong>.
Please <a href="/login" target="_blank">log in using a new browser window / tab</a>.
After logging in, switch back to this browser window / tab and save the changes.
</p>
</div>
<script type="text/javascript">
<!--
escape_escapeUi.startSessionStatusPoller('escape_notLoggedInWarning', 15000);
//-->
</script>

<div class="escape_Editor">
<?php
	// display the selected resource and it's properties
	$repositoryUi->displayOreObjectEditor($oreObject);
?>
</div>
<?php
	
	if($oreObject instanceof escape_repository_OreAggregation)
	{
		if($user && ($user->hasSystemRole(escape_repository_User::$role_administrator) || $aggregation->hasOwner($user->getUri())))
		{
			// this is an aggregation
			$containerElementId = $repositoryUi->getUniqueId();
?>
<div class="escape_Section">
<span class="escape_SectionTitle">User permissions</span>
<div id="<?php print htmlspecialchars($containerElementId); ?>">
<?php
			$repositoryUi->displayOreAggregationEditorListEditor($aggregation, $containerElementId);
?>
</div>
</div>
<?php
		}
	}
?>

<?php $this->displayFooter(); ?>
